package com.muyi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyi.pojo.dto.CategoryDTO;
import com.muyi.pojo.dto.CommentDTO;
import com.muyi.pojo.entity.Comment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author VRMMO
* @description 针对表【comment】的数据库操作Mapper
* @createDate 2025-06-11 15:04:41
* @Entity com.muyi.pojo.entity.Comment
*/
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    /**
     * 查询全部评论
     * @return
     */
    List<CommentDTO> list(@Param("content")String content, @Param("paper_title")String paper_title, @Param("nickname")String nickname);


    /**
     * 根据ID删除评论
     * @param comment_id
     */
    @Delete("delete from comment where comment_id = #{comment_id}")
    void deleteById(Integer comment_id);

    /**
     * 新增评论
     *
     * @param comment
     * @return
     */

    int insertAll(Comment comment);



    /**
     * 更新评论
     * @param comment
     */
    void update(Comment comment);

    @Select("select * from comment where comment_id = #{comment_id}")
    Comment getByCommentId(Integer comment_id);

}




